import React ,{Component} from 'react';
import { Icon } from 'antd';
import './Dlist.css';
 
export default class Dlist extends Component {
  constructor(props){
      super(props);
      this.state={};
      this.childItem = this.childItem.bind(this);
  }
  childItem = ()=>{
      let htmls = '';
    if(this.props.children){
        this.props.children.map((subItem,index) => {
            htmls+= <div className="list_item" key={index}>
                    <Icon type="plus-square-o" style={{ fontSize: 16, color: '#08c',marginRight:'10px'}}/>
                    {subItem.title}
                </div>
        })
        
    }
    return htmls;
}
    render (){
        let {item} = this.props;
        let htmlDom = ()=>{
            let htmls = '';
            Object.keys(item).map((key)=>{

                if(item[key] == 'children'){
                    item[key].map((subItem,index) => {
                        htmls+= <div className="list_item" key={index}>
                                <Icon type="plus-square-o" style={{ fontSize: 16, color: '#08c',marginRight:'10px'}}/>
                                {subItem.title}
                            </div>
                    })
                    
                }else{
                    htmls+= <div className="list_item">
                                <Icon type="plus-square-o" style={{ fontSize: 16, color: '#08c',marginRight:'10px'}}/>
                                {item[key]}
                            </div>
                }
              
            })
          return htmls;
      };
        return (
            <div className="Dlist">
                  <div className="list_item">
                    <Icon type="plus-square-o" style={{ fontSize: 16, color: '#08c',marginRight:'10px'}}/>
                    {item.title}
                  </div>
            </div>
        )
    }
}